<template>
    <NSpace vertical>
        <n-input v-model:value="textareaValue" type="textarea" maxlength="1000" show-count placeholder="请输入你的问题" />
        <n-checkbox checked>
            生成ai回答。
        </n-checkbox>
        <NButton type="success" @click="handleAsk">提问！</NButton>
    </NSpace>
</template>



<script setup lang="ts">
import { NCard, NSpace, NInput, NButton, NCheckbox } from "naive-ui";
import { ref } from "vue";
const textareaValue = ref('');
import qaUtils from "@/api/qa";
import { useRouter } from "vue-router";
const router = useRouter();

function handleAsk() {
    qaUtils.askQuestions(textareaValue.value).then((data) => {
        window.$utils.message.success("提交成功！");
        router.push({ name: "qa", params: { type: "my" } });
    }).catch((err) => {
        console.log(err);
    })
}

</script>